<?php
namespace app\index\model;


use think\Db;
use think\Model;


class Ads extends Model
{
    protected $table = 'shop_ad_position';//广告位
    protected $tables= 'shop_ad';         //广告


    function insertData($data)       //广告位增加
    {
        return Db::table($this->table)->insertGetId($data);
    }
     function insert($data)          //广告添加
    { 
        return Db::table($this->tables)->insertGetId($data);
    }
    function show()                  //广告位展示
    {
        return Db::table($this->table)->where('is_open', '=','1')->select();
    }
    function deleteData($id)         //广告位批删
    {
        return Db::table($this->table)->where('position_id','IN',$id)->delete();
    }
    function deleteDatas($id)        //广告批删
    {
        return Db::table($this->tables)->where('ad_id','IN',$id)->delete();
    }
    function findData($id)           //广告位查询单条数据
    {
        return Db::table($this->table)->where('position_id','=',$id)->find();
    }
    function findsData($id){         //广告查询单条数据
        return Db::table($this->tables)->where('ad_id','=',$id)->find();
    }
    function updateData($data,$id)   //广告位修改
    {
        return Db::table($this->table)->where('position_id','=',$id)->update($data);
    }
    function updatesData($data,$id){//广告修改
        return Db::table($this->tables)->where('ad_id','=',$id)->update($data);
    }
}